﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Shove.Web.UI;

public partial class UserControls_CartShow : UCBase 
{
    public UserControls_CartShow()
    {
        Name = "购物车信息";

        swpas = new ShoveWebPartAttribute[11];
        swpas[0] = new ShoveWebPartAttribute_Int("控件宽度", "1,1000", 220, "控件宽度");
        swpas[1] = new ShoveWebPartAttribute_Int("导航高度", "1,300", 28, "导航高度");
        swpas[2] = new ShoveWebPartAttribute_Int("导航背景图片单元格宽度", "1,600", 106, "导航背景图片单元格宽度");
   
        swpas[3] = new ShoveWebPartAttribute_Text("导航字体CSS样式", "", "title14", "导航字体CSS样式");

        swpas[4] = new ShoveWebPartAttribute_Image("导航背景图片1", "", "images/title_bg_2.jpg", "导航背景图片1");
        swpas[5] = new ShoveWebPartAttribute_Image("导航背景图片2", "", "images/title_bg_2_2.jpg", "导航背景图片2");
        swpas[6] = new ShoveWebPartAttribute_Image("行背景图片", "", "images/category_bg_2.jpg", "行背景图片");
    
        swpas[7] = new ShoveWebPartAttribute_Color("控件边框颜色", "#E7C890", "控件边框颜色");

        swpas[8] = new ShoveWebPartAttribute_Int("行高", "1,400", 26, "行高");
        swpas[9] = new ShoveWebPartAttribute_Text("用户名样式", "", "black12", "用户名样式");
        swpas[10] = new ShoveWebPartAttribute_Text("进入会员中心样式","","blue12","进入会员中心样式");
    }

    private void Initlayout()
    {
        //tabctr.Width = swpAttributes[0];
        //tabctr.BgColor = swpAttributes[7];
        //tdsign.Height = swpAttributes[1];
        //tdsign.Width = swpAttributes[2];
        //tdsign.Attributes.Add("class", swpAttributes[3]);
        //tdsign.Style.Add("background-image", "url('" + swpAttributes[4] + "')");
        //tdspace.Style.Add("background-image", "url('" + swpAttributes[5] + "')");

        //tab1.Style.Add("background-image", "url('" + swpAttributes[6] + "')");
        //tab2.Style.Add("background-image", "url('" + swpAttributes[6] + "')");
        //tab3.Style.Add("background-image", "url('" + swpAttributes[6] + "')");
        //tab4.Style.Add("background-image", "url('" + swpAttributes[6] + "')");

        tduser.Height = swpAttributes[8];
        tduser.Attributes.Add("class", swpAttributes[9]);

        tdcount.Height = swpAttributes[8];
        tdcount.Attributes.Add("class", swpAttributes[9]);

        tdtotalmoney.Height = swpAttributes[8];
        tdtotalmoney.Attributes.Add("class", swpAttributes[9]);

        tdalink.Height = swpAttributes[8];
        tdalink.Attributes.Add("class", swpAttributes[10]);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        Initlayout();

        if (_Customer != null)
        {
            lbUserName.Text = _Customer.CustomerName;
        }

        hCartType.Value = Shove._Web.Utility.GetRequest("CartType");    //哪个购物车(会员推荐专区、百企网)

        if (hCartType.Value == "carList2")
        {
            string sum = "0";
            lbGoodNum.Text = GoodOfCart.GetItems("carList2", ref sum).Count.ToString();
            lbGoodSum.Text = sum;
        }
        else
        {
            string sum = "0";
            lbGoodNum.Text = GoodOfCart.GetItems("carList", ref sum).Count.ToString();
            lbGoodSum.Text = sum;
        }
    }
}
